package com.luli.controllor;

import com.luli.dao.BigScreenDataDao;
import com.luli.entity.response.ResponseMsg;
import com.luli.service.BigScreenService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;
import java.util.List;
import java.util.Map;

import static com.luli.Utils.ResponseMsgUtil.getFailMsg;
import static com.luli.Utils.ResponseMsgUtil.getSuccessMsg;

/**
 * 陆离
 * 2022/11/15 9:35:12
 */
@RestController
@Slf4j
@RequestMapping("/BigScreen")
@CrossOrigin
public class BigScreenController {
    @Autowired
    private BigScreenService bigScreenService;

    /**
     * 127.0.0.1:8088/LuLi/queryBigScreen
     * @param date
     * @return
     * @throws IOException
     */
    @GetMapping("/queryBigScreen")
    public ResponseMsg<?> queryBigScreen(String date) throws IOException {
       try {
           List<BigScreenDataDao> bigScreenDataDaos = bigScreenService.queryBigScreenData(date);
           return getSuccessMsg("200", "查询成功", bigScreenDataDaos);
       }catch (Exception e){
           log.error("Error:"+e.getMessage());
           return getFailMsg(null, "查询失败", e.getMessage());
       }
    }
}
